package com.chen.servicedriveruser.controller;

import com.chen.internalcommon.dto.DriverUserWorkStatus;
import com.chen.internalcommon.dto.ResponseResult;
import com.chen.servicedriveruser.service.DriverUserWorkStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenliuping
 * @since 2022-11-27
 */
@RestController
@Slf4j
public class DriverUserWorkStatusController {
    @Autowired
    private DriverUserWorkStatusService driverUserWorkStatusService;

    /**
     * 修改司机工作状态
     * @param driverUserWorkStatus
     * @return
     */
    @PostMapping("/driver-user-work-status")
    public ResponseResult changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus) {
        Long driverId = driverUserWorkStatus.getDriverId();
        Integer workStatus = driverUserWorkStatus.getWorkStatus();
        log.info("司机id：{}  修改工作状态：{}", driverId, workStatus);
        return driverUserWorkStatusService.changeWorkStatus(driverId, workStatus);
    }
}
